<template>
	<view class="MyTeam">
		<view class="team-top">
			<view class="box">
				<text>直推人数</text>
				<text class="number">{{teamdata.direct_num}}</text>
			</view>
			<view class="box">
				<text>团队人数</text>
				<text class="number">{{teamdata.team_num}}</text>
			</view>
		</view>
		<view class="team-list">
			<view class="title">
				<text class="icon"></text>
				<text class="tit">直推用户</text>
			</view>
			<view class="list" v-for="(item,index) in list" :key="index">
				<image class="image" :src="item.avatar | imgurl"></image>
				<view class="name">
					<text>{{item.nickname}}</text>
					<text>{{item.mobile}}</text>
				</view>
				<view class="number">抢单{{item.order_num}}次</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						url: '../../static/img/30s.png',
						name: '王尔晓',
						phone: '00000000',
						num: '6'
					},
					
				],
				teamdata:[]
			};
		},
		onLoad: function() {
			this.getData();
		},
		methods: {
			getData: function() {
				const _this = this;
				//获取激活码
				this.$request.post("/api/ucenter/getTeam", {})
					.then(res => {

						if (res.data.code == 1) {
							_this.teamdata = res.data.data;
							_this.list = res.data.data.user_list;

						}
					})
					.catch(error => {
						console.error('error:', error);
					});
			}
		},
		filters: {
			imgurl(value) {
				value = 'http://www.huanqiuyt.com' + value
				return value
			},
			numFilter2(value) {
				// 截取当前数据到小数点后两位
				let realVal = Number(value).toFixed(1)
				// num.toFixed(2)获取的是字符串
				return Number(realVal)
			}
		}
	}
</script>

<style lang="less">
	.MyTeam {
		background-color: #F1F1F1;
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;

		.team-top {
			width: 96%;
			height: 100px;
			background-color: #FFFFFF;
			display: flex;
			border-top: 5px solid #F1F1F1;
			border-bottom: 10px solid #F1F1F1;
			font-size: 12px;
			color: #707070;

			.box {
				flex: 1;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;

				.number {
					color: #03AD8F;
					font-size: 22px;
				}
			}
		}

		.team-list {
			width: 96%;
			background-color: #FFFFFF;

			font-size: 12px;
			color: #24435D;

			.title {
				display: flex;
				height: 50px;
				align-items: center;

				.icon {
					width: 6px;
					height: 30px;
					background: rgba(39, 146, 229, 1);

				}

				.tit {
					font-size: 22px;
					flex: 1;
					padding-left: 16px;
				}
			}

			.list {
				height: 90px;
				display: flex;
				border-top: 1px solid #F1F1F1;
				align-items: center;
				padding: 0 20px;
				justify-content: space-between;

				.image {
					width: 54px;
					height: 54px;
					border-radius: 50%;
				}

				.name {
					flex: 1;
					display: flex;
					flex-direction: column;
					padding-left: 16px;
				}
			}
		}
	}
</style>
